package model

import mapset "github.com/deckarep/golang-set"

// SendMailRequest send mail request model
type SendMailRequest struct {
	AccountID   string            `json:"accountId"`
	RequestID   string            `json:"requestId"`
	From        string            `json:"from"`
	To          []string          `json:"to"`
	Cc          []string          `json:"cc"`
	Bcc         []string          `json:"bcc"`
	Subject     string            `json:"subject"`
	ContentType string            `json:"contentType"`
	Body        string            `json:"body"`
	Attachments map[string]string `json:"attachments"`
}

// Check 检测Model是否正常
func (r *SendMailRequest) Check() bool {
	availableContentType := mapset.NewSet("text/html")
	return len(r.AccountID) > 0 && len(r.RequestID) > 0 &&
		len(r.From) > 0 && len(r.To) > 0 && len(r.Subject) > 0 &&
		availableContentType.Contains(r.ContentType)
}
